Liking cljdoc? Tell your friends :D

com.wsscode.edn<->json


decode-keyclj/s

(decode-key s)

Decode string key to EDN, if key is not a string it is returned as is.

Decode string key to EDN, if key is not a string it is returned as is.
sourceraw docstring

decode-valueclj/s

(decode-value x
              {:com.wsscode.edn<->json/keys [decode-edn-values?]
               :or {decode-edn-values? true}})
source

edn->jsoncljs

(edn->json x)
(edn->json x
           {:com.wsscode.edn<->json/keys [encode-list-type?]
            :or {encode-list-type? true}
            :as opts})

Recursively transforms ClojureScript values to JavaScript.

The encoded JSON will have extra notation to enable a better deserialization later, keeping complex keys, keyword keys (simple and qualified), also encode extended types like UUID and dates. Using json->edn you can restore the original data from the JSON.

Some things that don't get restored:

  • metadata is lost
  • number keys on maps will be turned into strings on the conversion back

Other than that, all printable values should encode and decode with fidelity.

Recursively transforms ClojureScript values to JavaScript.

The encoded JSON will have extra notation to enable a better deserialization
later, keeping complex keys, keyword keys (simple and qualified), also encode
extended types like UUID and dates. Using json->edn you can restore the original
data from the JSON.

Some things that don't get restored:

- metadata is lost
- number keys on maps will be turned into strings on the conversion back

Other than that, all printable values should encode and decode with fidelity.
sourceraw docstring

edn->json-likeclj/s

(edn->json-like x)
(edn->json-like x
                {:com.wsscode.edn<->json/keys [encode-list-type?]
                 :or {encode-list-type? true}
                 :as opts})

Same as edn->json, but returns Clojure maps that are JSON friendly instead of the JSON directly. This is useful as a middle format if you need to later send it encoded as JSON.

Same as edn->json, but returns Clojure maps that are JSON friendly instead of the
JSON directly. This is useful as a middle format if you need to later send it encoded
as JSON.
sourceraw docstring

edn-value-str?clj/s

(edn-value-str? x)
source

encode-keyclj/s

(encode-key x {:com.wsscode.edn<->json/keys [encode-map-key]})

Encode map key, keywords numbers and strings are always encoded as strings. By default encode other keys using the prefix __edn-key| and the END encoded value.

If you provide ::encode-map-key, this will be used instead of the default encode.

Encode map key, keywords numbers and strings are always encoded as strings. By
default encode other keys using the prefix `__edn-key|` and the END encoded value.

If you provide ::encode-map-key, this will be used instead of the default encode.
sourceraw docstring

encode-valueclj/s

(encode-value x {:com.wsscode.edn<->json/keys [encode-value]})

Encode value representation, can be overwritten with the ::encode-value setting.

Encode value representation, can be overwritten with the ::encode-value setting.
sourceraw docstring

js-obj?cljs

(js-obj? x)
source

json->edncljs

(json->edn x)
(json->edn x opts)

Recursively transforms JavaScript arrays into ClojureScript vectors, and JavaScript objects into ClojureScript maps.

Use to get fidelity restore of JSON data encoded with edn->json.

Recursively transforms JavaScript arrays into ClojureScript
vectors, and JavaScript objects into ClojureScript maps.

Use to get fidelity restore of JSON data encoded with edn->json.
sourceraw docstring

json-like->ednclj/s

(json-like->edn x)
(json-like->edn x opts)

Recursively transforms JavaScript arrays into ClojureScript vectors, and JavaScript objects into ClojureScript maps.

Use to get fidelity restore of JSON data encoded with edn->json.

Recursively transforms JavaScript arrays into ClojureScript
vectors, and JavaScript objects into ClojureScript maps.

Use to get fidelity restore of JSON data encoded with edn->json.
sourceraw docstring

simple-js-type?clj/s

(simple-js-type? x)

Return true for simple JS types. The intended use of this function is to detect if a value should be stored in its original form, for values that return false here, its expected that they get some encoding process before ending up as a JS value.

Return true for simple JS types. The intended use of this function is to detect if
a value should be stored in its original form, for values that return false here, its
expected that they get some encoding process before ending up as a JS value.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close